(function() {
var mongoose, schema;

mongoose = require('mongoose');
 
schema = mongoose.Schema({
  content: String
  , date: String
  , user_id: mongoose.Schema.Types.ObjectId
});

schema.methods.post = function(cb) {
  return this.save(cb);
};

schema.methods.findByUserid = function(cb) {
  return cb();
};

schema.methods.register = function(cb) {
  var me;
  me = this;
  return db.user.findOne({
    username: this.username
  }, function(error, data) {
    if (error) {
      return cb(error, null);
    }
    else if (data) {
      return cb(new mongoose.Error('User account existed'), null);
    } 
    else {
      return me.save(cb);
    }
  });
};

exports = schema;
}).call(this);